﻿@model IEnumerable<HdipCricketClub.Models.Member>

@{
    ViewBag.Title = "Members:";
}

<h2>@ViewBag.Title</h2>

@using (Html.BeginForm())
{
    <p>
        Find by Last Name: @Html.TextBox("SearchString")
        <input type="submit" value="Search" />
    </p>
}

<table>
    <tr>
        <th>
            Name:
        </th>
        <th>
            Address:
        </th>
        <th>
            Mobile:
        </th>
        <th>
            Phone:
        </th>
        <th>
            E Mail:
        </th>
        <th>
            Player:
        </th>
   </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.first_name) @Html.DisplayFor(modelItem => item.last_name)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.address_1),
            @if(item.address_2 != null)
            {
            @Html.DisplayFor(modelItem => item.address_2)@:,
            }
            @Html.DisplayFor(modelItem => item.town_city),
            @Html.DisplayFor(modelItem => item.County1.name).
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.mobile)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.phone)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.email)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.playing_member)
        </td>
      </tr>
}

</table>
